package com.cloud.drore.eboss.supplier.service.impl;

import com.cloud.drore.eboos.common.base.BaseServiceImpl;
import com.cloud.drore.eboos.common.base.MyMapper;
import com.cloud.drore.eboos.common.base.PagePo;
import com.cloud.drore.eboos.common.base.ResultMessage;
import com.cloud.drore.eboss.supplier.entity.Supplier;
import com.cloud.drore.eboss.supplier.mapper.SupplierMapper;
import com.cloud.drore.eboss.supplier.service.ISupplierService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 浙江卓锐科技股份有限公司 版权所有  Copyright 2018<br>
 *
 * @Description: <br>
 * @Project: eboos <br>
 * @CreateDate: Created in 2018/1/8 13:49 <br>
 * @Author: <a href="575842778@qq.com">郑永涛</a>
 */
@Service
public class SupplierServiceImpl extends BaseServiceImpl implements ISupplierService {

    @Autowired
    SupplierMapper supplierMapper;

    @Override
    public MyMapper getMapper() {
        return supplierMapper;
    }

    /**
     * @ClassName: SupplierServiceImpl
     * @param page
     * @Return: com.cloud.drore.eboos.common.base.ResultMessage
     * @Decription:
     * @CreateDate: Created in 2018/1/8 11:15
     * @Author: <a href="575842778@qq.com">郑永涛</a>
     * @Modify:
     */
    public ResultMessage findByName(PagePo page) {
        PageHelper.startPage(page);
        List list = supplierMapper.selectAll();
        return new ResultMessage(new PageInfo<>(list));
    }

    public ResultMessage findByParms(Supplier supplier, PagePo page) {
        PageHelper.startPage(page);
        List page1 = supplierMapper.findByParms(supplier);
        return	ResultMessage.success(new PageInfo<>(page1));
    }

}